package com.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.SaleOrderBean;
import com.project.mapper.ISaleOrderMapper;
import com.project.service.ISaleOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

@Service
@Transactional
public class SaleOrderServiceImpl implements ISaleOrderService {

    @Autowired
    private ISaleOrderMapper saleOrderMapper;


    @Override
    public IPage<SaleOrderBean> findByItem(Integer pageNO, String clientName, LocalDate startDate, LocalDate endDate) {
        return saleOrderMapper.findByItem(new Page<>(pageNO,3),clientName,startDate,endDate);
    }

    @Override
    public SaleOrderBean findById(Integer saleOrderId) {
        return saleOrderMapper.findById(saleOrderId);
    }

    @Override
    public Integer add(SaleOrderBean saleOrder) {
        return saleOrderMapper.insert(saleOrder);
    }
}
